﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SuuntoAmbitConnector;

namespace SuuntoAmbitConnectorTests
{
    [TestClass]
    public class EndomondoActivityMappingTests
    {
        [TestMethod]
        public void TestSuuntoAmbitCyclingActivityMapsEndomdondoCyclingSportActivity()
        {
            var expectedEndomondoActivityType = 2;
            var suuntoAmbitCyclingActivity = 4;

            VerifySuuntoAmbitToEndomondoActityTypeMapping(suuntoAmbitCyclingActivity, expectedEndomondoActivityType);
        }             

        [TestMethod]
        public void TestSuuntoAmbitRunningActivityMapsEndomdondoRunningActivity()
        {
            var expectedEndomondoActivityType = 0;
            var suuntoAmbitRunningActivity = 3;

            VerifySuuntoAmbitToEndomondoActityTypeMapping(suuntoAmbitRunningActivity, expectedEndomondoActivityType);
        }

        [TestMethod]
        public void TestSuuntoAmbitMountainBikeActivityMapsEndomondoMountainBikeActivity()
        {
            var expectedEndomondoActivityType = 3;
            var suuntoAmbitMountainBikeActivity = 5;

            VerifySuuntoAmbitToEndomondoActityTypeMapping(suuntoAmbitMountainBikeActivity, expectedEndomondoActivityType);
        }

        private void VerifySuuntoAmbitToEndomondoActityTypeMapping(int suuntoAmbitCyclingActivity, int expectedEndomondoActivityType)
        {
            var endomondoActivityType = EndomondoActivityMapping.GetEndomondoActivityType(suuntoAmbitCyclingActivity);

            Assert.AreEqual(expectedEndomondoActivityType, endomondoActivityType, "Unexpected Endomondo Activity Type");
        }

        [TestMethod]
        [ExpectedException(typeof(ArgumentException))]
        public void TestUnknownSuuntoAmbitActivityCodeThrowsArgumentException()
        {
            EndomondoActivityMapping.GetEndomondoActivityType(-1);
        }

        /*
         * Endomondo activity types 9/19/2013
<option value="0">Running</option>
<option value="2">Cycling, sport</option>
<option value="1">Cycling, transport</option>
<option value="14">Fitness walking</option>
<option value="15">Golfing</option>
<option value="16">Hiking</option>
<option value="21">Indoor cycling</option>
<option value="9">Kayaking</option>
<option value="10">Kite surfing</option>
<option value="3">Mountain biking</option>
<option value="17">Orienteering</option>
<option value="19">Riding</option>
<option value="5">Roller skiing</option>
<option value="11">Rowing</option>
<option selected="selected" value="0">Running</option>
<option value="12">Sailing</option>
<option value="4">Skating</option>
<option value="6">Skiing, cross country</option>
<option value="7">Skiing, downhill</option>
<option value="8">Snowboarding</option>
<option value="20">Swimming</option>
<option value="18">Walking</option>
<option value="13">Windsurfing</option>
<option value="22">Other</option>
<option value="23">&nbsp;&nbsp;&nbsp;&nbsp;Aerobics</option>
<option value="24">&nbsp;&nbsp;&nbsp;&nbsp;Badminton</option>
<option value="25">&nbsp;&nbsp;&nbsp;&nbsp;Baseball</option>
<option value="26">&nbsp;&nbsp;&nbsp;&nbsp;Basketball</option>
<option value="27">&nbsp;&nbsp;&nbsp;&nbsp;Boxing</option>
<option value="28">&nbsp;&nbsp;&nbsp;&nbsp;Climbing stairs</option>
<option value="29">&nbsp;&nbsp;&nbsp;&nbsp;Cricket</option>
<option value="30">&nbsp;&nbsp;&nbsp;&nbsp;Elliptical training</option>
<option value="31">&nbsp;&nbsp;&nbsp;&nbsp;Dancing</option>
<option value="32">&nbsp;&nbsp;&nbsp;&nbsp;Fencing</option>
<option value="33">&nbsp;&nbsp;&nbsp;&nbsp;Football, American</option>
<option value="34">&nbsp;&nbsp;&nbsp;&nbsp;Football, rugby</option>
<option value="35">&nbsp;&nbsp;&nbsp;&nbsp;Football, soccer</option>
<option value="49">&nbsp;&nbsp;&nbsp;&nbsp;Gymnastics</option>
<option value="36">&nbsp;&nbsp;&nbsp;&nbsp;Handball</option>
<option value="37">&nbsp;&nbsp;&nbsp;&nbsp;Hockey</option>
<option value="48">&nbsp;&nbsp;&nbsp;&nbsp;Martial arts</option>
<option value="38">&nbsp;&nbsp;&nbsp;&nbsp;Pilates</option>
<option value="39">&nbsp;&nbsp;&nbsp;&nbsp;Polo</option>
<option value="40">&nbsp;&nbsp;&nbsp;&nbsp;Scuba diving</option>
<option value="41">&nbsp;&nbsp;&nbsp;&nbsp;Squash</option>
<option value="42">&nbsp;&nbsp;&nbsp;&nbsp;Table tennis</option>
<option value="43">&nbsp;&nbsp;&nbsp;&nbsp;Tennis</option>
<option value="44">&nbsp;&nbsp;&nbsp;&nbsp;Volleyball, beach</option>
<option value="45">&nbsp;&nbsp;&nbsp;&nbsp;Volleyball, indoor</option>
<option value="46">&nbsp;&nbsp;&nbsp;&nbsp;Weight training</option>
<option value="47">&nbsp;&nbsp;&nbsp;&nbsp;Yoga</option>
<option value="50">&nbsp;&nbsp;&nbsp;&nbsp;Step counter</option>
<option value="87">&nbsp;&nbsp;&nbsp;&nbsp;Circuit Training</option>
<option value="88">&nbsp;&nbsp;&nbsp;&nbsp;Treadmill running</option>
<option value="89">&nbsp;&nbsp;&nbsp;&nbsp;Skateboarding</option>
<option value="90">&nbsp;&nbsp;&nbsp;&nbsp;Surfing</option>
<option value="91">&nbsp;&nbsp;&nbsp;&nbsp;Snowshoeing</option>
<option value="92">&nbsp;&nbsp;&nbsp;&nbsp;Wheelchair</option>
<option value="93">&nbsp;&nbsp;&nbsp;&nbsp;Climbing</option>
<option value="94">&nbsp;&nbsp;&nbsp;&nbsp;Treadmill walking</option>
         * 
         */
    }
}
